package com.zeny.online.netty;


import io.netty.channel.Channel;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @ClassName UserChannelRel
 * @Description 用户ID和channel的关联关系处理
 * @Author zeny
 */
public class UserChannelRel {

    private static Map<String, Channel> manager = new ConcurrentHashMap<String, Channel>();

    public static void put(String sendId, Channel channel) {
        manager.put(sendId, channel);
    }

    public static Channel get(String sendId) {
        return manager.get(sendId);
    }

    public static void output() {
        for (Map.Entry m : manager.entrySet()) {
            System.out.println("userid = " + m.getKey() + ", channel = " + m.getValue());
        }
    }
}
